/****************************************************************************
**
** Copyright (C) TERIFLIX Entertainment Spaces Pvt. Ltd. Bengaluru
** Author: Prashanth N Udupa (prashanth.udupa@teriflix.com)
**
** This code is distributed under GPL v3. Complete text of the license
** can be found here: https://www.gnu.org/licenses/gpl-3.0.txt
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/

#include "colorimageprovider.h"

ColorImageProvider::ColorImageProvider()
    : QQuickImageProvider(QQuickImageProvider::Image)
{

}

ColorImageProvider::~ColorImageProvider()
{

}

QImage ColorImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
{
    const QSize defaultSize(64, 64);
    QImage image(requestedSize.isEmpty() ? defaultSize : requestedSize, QImage::Format_ARGB32);
    if(size)
        *size = defaultSize;
    image.fill( QColor(id).rgba() );
    return image;
}
